/*
 * Class.java
 *
 * Created on 3 de Abril de 2008, 21:51
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package Server.GameRules;
import java.util.Vector;

/**
 *
 * @author thiago c fernandes
 */
public class Class {
     private String name;
    private String description;
    private Vector<Magic> magics;
    private Vector<Skill> skills;
        
    /** Creates a new instance of class */
    public Class() {
        setName("");
        setDescription("");
        skills = new Vector<Skill>();
        magics = new Vector<Magic>();
    }
    
    /** 
     * Sets the class name
     * @param name The name to be setted
     *
     */
    public void setName(String name){
        this.name = name;
    }
    
    /**
     * Sets the class description
     * @param description The description to be setted
     *
     */
    public void setDescription(String description){
        this.description = description;
    }
    
    /**
     * Inserts a magic in the class list of the availables magics
     * @param magic The magic to be inserted
     *
     */
    public void insertMagic(Magic magic){
        magics.addElement(magic);
    }

    /**
     * Removes a magic from the class list of the availables magics
     * @param magic The magic to be removed
     *
     */
    public boolean removeMagic(Magic magic){
        return magics.removeElement(magic);
    }
    
    /**
     * Inserts a skill in the class list of the availables skills
     * @param skill The skill to be inserted
     *
     */    
    public void insertSkill(Skill skill){
        skills.addElement(skill);
    }
    
    /**
     * Removes a skill from the class list of availables skills
     * @param skill The skilll to be removed 
     *
     */
    public boolean removeSkill(Skill skill){
        return skills.removeElement(skill);
    }
    
    /**
     * Confirms if the magic is in available list
     * @param magic The magic to be confirmed
     *
     */
    public boolean isclassMagic(Magic magic){
        int i = 0;
        while(i < magics.size()){
            if(magics.elementAt(i).equals(magic)){
                return true;
            }
        }
        return false;
    }
    
    /**
     * Confirms if the skill is in the available list
     * @param skill The skill to bem confirmed
     *
     */
    public boolean isclassSkill(Skill skill){
        int i = 0;
        while(i < skills.size()){
            if(skills.elementAt(i).equals(skill)){
                return true;
            }
        }
        return false;
    }
    
    /**
     * Gets the name of the class
     *
     */
    public String getName(){
        return this.name;
    }

    /**
     * Gets the description of the class
     *
     */
    public String getDescription(){
        return this.description;
    }
    
}
